package com.engine.kq.biz.chain.shiftinfo;

import com.engine.kq.entity.TimeScopeEntity;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 1、首先有个KQTimesArrayComInfo缓存类，这个类把00:00-23:59的时间点都转换成了0-1439的数值
 * 我把这个数值视作下标index
 *
 * 2、假如班次设置的工作时段是
 *  8:00-12:00
 *  13:00-18:00
 *  22:00-次日4:00
 *
 * 3、...
 *
 * 4、那么restTimes表示的就是休息时段15:00-16:00对应的数组下标{[100,200]}，举个栗子而已
 *
 * 5、那么workIndex表示的就是休息时段8:00-12:00...对应的数组下标{[50,80],[90,180],[250,280]}，workIndexTime存的就是时间点举个栗子而已
 *
 * 6、那么halfWorkIndex表示的就是半天规则情况下需要用到的数组下标
 * 上面的例子里的工作时长的15个小时，所以半天的话，需要从8:00-16:30，只要是满足小于这个范围段内的都是半天，大于的就是1天了
 * halfWorkIndex对应的数组下标就是{[50,70]}，halfWorkIndexTime存的就是时间点举个栗子而已
 *
 * 7、那么wholeWorkIndex表示的就是整天规则情况下需要用到的数组下标，我只需要知道workIndex就可以了。wholeWorkIndexTime存的就是时间点
 *
 */
public class ShiftInfoBean {
  /**
   * 指定开始时间
   */
  private String splitFromTime;
  /**
   * 指定结束时间
   */
  private String splitToTime;

  /**
   * 指定日期 因为流程时段区间已经被拆分成一天一条了
   */
  private String splitDate;
  /**
   * 要返回当天的工作时间区间对应的数组下标 这个是不包含跨天的
   */
  private List<int[]> workIndex;

  /**
   * 要返回当天的工作时间区间对应的数组下标 这个是包含跨天的
   */
  private List<int[]> workAcrossIndex;

  /**
   * 要返回当天的工作时间区间对应的时间 这个是包含跨天的
   */
  private List<String[]> workAcrossTime;

  /**
   * 当天打卡时段时间：多少分钟可以开始签到签退的
   */
  private List<String[][]> workMinsAcrossIndex;
  /**
   * 要返回的休息时间区间对应的数组下标 不包含跨天
   */
  private List<int[]> restIndex;
  /**
   * 要返回的休息时间区间对应的数组下标 包含跨天的
   */
  private List<int[]> restAcrossIndex;
  /**
   * 要返回的半天规则时间区间对应的数组下标
   * 这里有值的话是三个，最早的开始时间 中间时间 最晚的下班时间
   */
  private List<int[]> halfWorkIndex;

  /**
   * 工作时长
   */
  private int workmins;

  private int signoutOnlyoff;

  /**
   * 加班用的前日期是何种类型
   */
  private int changeType;

  /**
   * 当前日期的班次
   */
  private String serialid;

  /**
   * 指定日期的前一天，因为存在跨天，昨天数据可能也需要在今天统计
   */
  private String preSplitDate;

  /**
   * 这个返回的是前一天的班次存在跨天，跨到今天的工作时段区间
   */
  private List<int[]> preWorkIndex;

  /**
   * 要返回前一天天的工作时间区间对应的数组下标 这个是包含跨天的
   */
  private List<int[]> preWorkAcrossIndex;

  /**
   * 要返回前一天打卡时段信息：多少分钟可以开始签到签退的
   */
  private List<String[][]> preWorkMinsAcrossIndex;

  /**
   * 映射前一天的跨天和时间区间下标
   */
  private Map<String,String> preWorktimeAcrossMap;
  /**
   * 要返回前一天的休息时间区间对应的数组下标
   */
  private List<int[]> preRestIndex;
  /**
   * 要返回的前一天的半天规则时间区间对应的数组下标
   * 这里有值的话是三个，开始时间 中间时间 下班时间
   */
  private List<int[]> preHalfWorkIndex;

  /**
   * 前一天的工作时长
   */
  private int preWorkmins;

  /**
   * 前一个日期的班次
   */
  private String preSerialid;

  /**
   * 得到实际时长分钟数
   */
  private double D_Mins;

  /**
   * 流程判断的各种规则
   * 半天小时的
   */
  private String minimumUnit;

  /**
   * 流程用的时候存的值
   */
  private String duration;

  /**
   * 针对时段跨天 流程跨天的情况，23:59-24:00差一分钟的处理
   */
  private String oneMoreMinute;

  /**
   * 当前时间段
   */
  private int[] curMins;

  /**
   * 当前时间段
   */
  private int[] preMins;

    /**
     * 存储所有的工作时间
     */
    private List<String> allWorkTime;

    /**
     * 存储所有的跨天时间
     */
    private List<String> allAcrossWorkTime;
    /**
     * 存储所有的休息时间
     */
    private List<String> allRestTime;

    /**
     * 存储所有的休息时间
     */
    private List<String> allAcrossRestTime;



  /**
   * 存储所有的工作时间
   */
  private List<String> preAllWorkTime;

  /**
   * 存储所有的跨天时间
   */
  private List<String> preAllAcrossWorkTime;
  /**
   * 存储所有的休息时间
   */
  private List<String> preAllRestTime;

  /**
   * 存储所有的休息时间
   */
  private List<String> preAllAcrossRestTime;

  /**
   * 是否是自由班製
   */
  private boolean isfree;
  /**
   * 自由班制签到开始时间
   */
  private String freeSignStart;
  /**
   * 自由班制工作时长
   */
  private String freeWorkMins;
  /**
   * 自由班制应该签退时间
   */
  private String freeSignEnd;
  /**
   * 自由班制 半天中间点
   */
  private String freeSignMiddle;


  /**
   * 当前班次作为当前班次存在，在0-48小时内的工作时段下标
   */
  private List<int[]> workLongTimeIndex;

  /**
   * 当前班次作为当前班次存在，在0-48小时内的工作时段下标
   */
  private List<int[]> restLongTimeIndex;

  /**
   * 存储所有的工作时间 48小时制休息时段
   */
  private List<String> allLongWorkTime;

  /**
   * 判断当前班次是否存在跨天
   */
  private String isAcross;

  /**
   * 判断前一天班次是否存在跨天
   */
  private String isPreAcross;

  private Map<String,Object> shiftRuleMap;

  /**
   * 和kqformdate里的workTimeEntity用到的保持一致
   */
  private List<TimeScopeEntity> signTime;//允许打卡时间
  /**
   * 和kqformdate里的workTimeEntity用到的保持一致
   */
  private List<TimeScopeEntity> workTime;//工作时间

  /**
   * 半天计算规则
   */
  private String halfcalrule;

  /**
   * 自定义 半天计算规则 时间点
   */
  private String halfcalpoint;

  private String halfcalpoint2cross;

  /**
   * 存储每一段工作时段内的工作时长
   */
  private List<Integer> eachWorkMins;
    /**
     * 是否是非工作日 1表示是非工作日班次
     */
    private int restShift;

    /**
     * 昨天应出勤折算天数
     */
    private String preConvertAttendDay = "";

    /**
     * 应出勤折算天数
     */
    private String convertAttendDay = "";

  public ShiftInfoBean() {
    this.splitFromTime = "";
    this.splitToTime = "";
    this.splitDate = "";
    this.workIndex = new ArrayList<>();
    this.workAcrossIndex = new ArrayList<>();
    this.restIndex = new ArrayList<>();
    this.restAcrossIndex = new ArrayList<>();
    this.halfWorkIndex = new ArrayList<>();
    this.workmins = 0;
    this.signoutOnlyoff = 0;
    this.preSplitDate = "";
    this.preWorkIndex = new ArrayList<>();
    this.preWorkAcrossIndex = new ArrayList<>();
    this.preWorktimeAcrossMap = new HashMap<>();
    this.preRestIndex = new ArrayList<>();
    this.preHalfWorkIndex = new ArrayList<>();
    this.preWorkmins = 0;
    this.D_Mins = 0.0;
    this.minimumUnit = "";
    this.duration = "";
    this.oneMoreMinute = "";
    this.preWorkMinsAcrossIndex = new ArrayList<>();
    this.workMinsAcrossIndex = new ArrayList<>();
    this.preSerialid = "";
    this.serialid = "";
    this.workAcrossTime = new ArrayList<>();
    this.isfree = false;
    this.freeSignStart = "";
    this.freeWorkMins = "";
    this.freeSignEnd = "";
    this.freeSignMiddle = "";

    this.workLongTimeIndex = new ArrayList<>();
    this.restLongTimeIndex = new ArrayList<>();
    this.allLongWorkTime = new ArrayList<>();
    this.isAcross = "";
    this.isPreAcross = "";
    this.shiftRuleMap = Maps.newHashMap();
    this.workTime = Lists.newArrayList();
    this.signTime = Lists.newArrayList();
    this.halfcalrule = "";
    this.halfcalpoint = "";
    this.halfcalpoint2cross = "";
    this.eachWorkMins = new ArrayList<>();
  }

  public String getSplitDate() {
    return splitDate;
  }

  public void setSplitDate(String splitDate) {
    this.splitDate = splitDate;
  }

  public String getSplitFromTime() {
    return splitFromTime;
  }

  public void setSplitFromTime(String splitFromTime) {
    this.splitFromTime = splitFromTime;
  }

  public String getSplitToTime() {
    return splitToTime;
  }

  public void setSplitToTime(String splitToTime) {
    this.splitToTime = splitToTime;
  }

  public List<int[]> getWorkIndex() {
    return workIndex;
  }

  public void setWorkIndex(List<int[]> workIndex) {
    this.workIndex = workIndex;
  }

  public List<int[]> getRestIndex() {
    return restIndex;
  }

  public void setRestIndex(List<int[]> restIndex) {
    this.restIndex = restIndex;
  }

  public List<int[]> getHalfWorkIndex() {
    return halfWorkIndex;
  }

  public void setHalfWorkIndex(List<int[]> halfWorkIndex) {
    this.halfWorkIndex = halfWorkIndex;
  }

  public double getD_Mins() {
    return D_Mins;
  }

  public void setD_Mins(double d_Mins) {
    D_Mins = d_Mins;
  }

  public String getPreSplitDate() {
    return preSplitDate;
  }

  public void setPreSplitDate(String preSplitDate) {
    this.preSplitDate = preSplitDate;
  }

  public List<int[]> getPreWorkIndex() {
    return preWorkIndex;
  }

  public void setPreWorkIndex(List<int[]> preWorkIndex) {
    this.preWorkIndex = preWorkIndex;
  }

  public List<int[]> getWorkAcrossIndex() {
    return workAcrossIndex;
  }

  public void setWorkAcrossIndex(List<int[]> workAcrossIndex) {
    this.workAcrossIndex = workAcrossIndex;
  }

  public int getWorkmins() {
    return workmins;
  }

  public void setWorkmins(int workmins) {
    this.workmins = workmins;
  }

  public int getSignoutOnlyoff() {
    return signoutOnlyoff;
  }

  public void setSignoutOnlyoff(int signoutOnlyoff) {
    this.signoutOnlyoff = signoutOnlyoff;
  }

  public String getMinimumUnit() {
    return minimumUnit;
  }

  public void setMinimumUnit(String minimumUnit) {
    this.minimumUnit = minimumUnit;
  }

  public List<int[]> getPreHalfWorkIndex() {
    return preHalfWorkIndex;
  }

  public void setPreHalfWorkIndex(List<int[]> preHalfWorkIndex) {
    this.preHalfWorkIndex = preHalfWorkIndex;
  }

  public List<int[]> getPreWorkAcrossIndex() {
    return preWorkAcrossIndex;
  }

  public void setPreWorkAcrossIndex(List<int[]> preWorkAcrossIndex) {
    this.preWorkAcrossIndex = preWorkAcrossIndex;
  }

  public Map<String, String> getPreWorktimeAcrossMap() {
    return preWorktimeAcrossMap;
  }

  public void setPreWorktimeAcrossMap(
      Map<String, String> preWorktimeAcrossMap) {
    this.preWorktimeAcrossMap = preWorktimeAcrossMap;
  }

  public List<int[]> getPreRestIndex() {
    return preRestIndex;
  }

  public void setPreRestIndex(List<int[]> preRestIndex) {
    this.preRestIndex = preRestIndex;
  }

  public int getPreWorkmins() {
    return preWorkmins;
  }

  public void setPreWorkmins(int preWorkmins) {
    this.preWorkmins = preWorkmins;
  }

  public List<int[]> getRestAcrossIndex() {
    return restAcrossIndex;
  }

  public void setRestAcrossIndex(List<int[]> restAcrossIndex) {
    this.restAcrossIndex = restAcrossIndex;
  }

  public String getDuration() {
    return duration;
  }

  public void setDuration(String duration) {
    this.duration = duration;
  }

  public String getOneMoreMinute() {
    return oneMoreMinute;
  }

  public void setOneMoreMinute(String oneMoreMinute) {
    this.oneMoreMinute = oneMoreMinute;
  }

  public List<String[][]> getWorkMinsAcrossIndex() {
    return workMinsAcrossIndex;
  }

  public void setWorkMinsAcrossIndex(List<String[][]> workMinsAcrossIndex) {
    this.workMinsAcrossIndex = workMinsAcrossIndex;
  }

  public List<String[][]> getPreWorkMinsAcrossIndex() {
    return preWorkMinsAcrossIndex;
  }

  public void setPreWorkMinsAcrossIndex(List<String[][]> preWorkMinsAcrossIndex) {
    this.preWorkMinsAcrossIndex = preWorkMinsAcrossIndex;
  }

  public String getSerialid() {
    return serialid;
  }

  public void setSerialid(String serialid) {
    this.serialid = serialid;
  }

  public String getPreSerialid() {
    return preSerialid;
  }

  public void setPreSerialid(String preSerialid) {
    this.preSerialid = preSerialid;
  }

  public int[] getCurMins() {
    return curMins;
  }

  public void setCurMins(int[] curMins) {
    this.curMins = curMins;
  }

  public int[] getPreMins() {
    return preMins;
  }

  public void setPreMins(int[] preMins) {
    this.preMins = preMins;
  }

  public List<String[]> getWorkAcrossTime() {
    return workAcrossTime;
  }

  public void setWorkAcrossTime(List<String[]> workAcrossTime) {
    this.workAcrossTime = workAcrossTime;
  }

  public int getChangeType() {
    return changeType;
  }

  public void setChangeType(int changeType) {
    this.changeType = changeType;
  }

  public List<String> getAllWorkTime() {
    return allWorkTime;
  }

  public void setAllWorkTime(List<String> allWorkTime) {
    this.allWorkTime = allWorkTime;
  }

  public List<String> getAllAcrossWorkTime() {
    return allAcrossWorkTime;
  }

  public void setAllAcrossWorkTime(List<String> allAcrossWorkTime) {
    this.allAcrossWorkTime = allAcrossWorkTime;
  }

  public List<String> getAllRestTime() {
    return allRestTime;
  }

  public void setAllRestTime(List<String> allRestTime) {
    this.allRestTime = allRestTime;
  }

  public List<String> getAllAcrossRestTime() {
    return allAcrossRestTime;
  }

  public void setAllAcrossRestTime(List<String> allAcrossRestTime) {
    this.allAcrossRestTime = allAcrossRestTime;
  }

  public List<String> getPreAllWorkTime() {
    return preAllWorkTime;
  }

  public void setPreAllWorkTime(List<String> preAllWorkTime) {
    this.preAllWorkTime = preAllWorkTime;
  }

  public List<String> getPreAllAcrossWorkTime() {
    return preAllAcrossWorkTime;
  }

  public void setPreAllAcrossWorkTime(List<String> preAllAcrossWorkTime) {
    this.preAllAcrossWorkTime = preAllAcrossWorkTime;
  }

  public List<String> getPreAllRestTime() {
    return preAllRestTime;
  }

  public void setPreAllRestTime(List<String> preAllRestTime) {
    this.preAllRestTime = preAllRestTime;
  }

  public List<String> getPreAllAcrossRestTime() {
    return preAllAcrossRestTime;
  }

  public void setPreAllAcrossRestTime(List<String> preAllAcrossRestTime) {
    this.preAllAcrossRestTime = preAllAcrossRestTime;
  }

  public boolean isIsfree() {
    return isfree;
  }

  public void setIsfree(boolean isfree) {
    this.isfree = isfree;
  }

  public String getFreeSignStart() {
    return freeSignStart;
  }

  public void setFreeSignStart(String freeSignStart) {
    this.freeSignStart = freeSignStart;
  }

  public String getFreeWorkMins() {
    return freeWorkMins;
  }

  public void setFreeWorkMins(String freeWorkMins) {
    this.freeWorkMins = freeWorkMins;
  }

  public String getFreeSignEnd() {
    return freeSignEnd;
  }

  public void setFreeSignEnd(String freeSignEnd) {
    this.freeSignEnd = freeSignEnd;
  }

  public String getFreeSignMiddle() {
    return freeSignMiddle;
  }

  public void setFreeSignMiddle(String freeSignMiddle) {
    this.freeSignMiddle = freeSignMiddle;
  }

  public List<int[]> getWorkLongTimeIndex() {
    return workLongTimeIndex;
  }

  public void setWorkLongTimeIndex(List<int[]> workLongTimeIndex) {
    this.workLongTimeIndex = workLongTimeIndex;
  }

  public List<int[]> getRestLongTimeIndex() {
    return restLongTimeIndex;
  }

  public void setRestLongTimeIndex(List<int[]> restLongTimeIndex) {
    this.restLongTimeIndex = restLongTimeIndex;
  }

  public List<String> getAllLongWorkTime() {
    return allLongWorkTime;
  }

  public void setAllLongWorkTime(List<String> allLongWorkTime) {
    this.allLongWorkTime = allLongWorkTime;
  }

  public String getIsAcross() {
    return isAcross;
  }

  public void setIsAcross(String isAcross) {
    this.isAcross = isAcross;
  }

  public String getIsPreAcross() {
    return isPreAcross;
  }

  public void setIsPreAcross(String isPreAcross) {
    this.isPreAcross = isPreAcross;
  }

  public Map<String, Object> getShiftRuleMap() {
    return shiftRuleMap;
  }

  public void setShiftRuleMap(Map<String, Object> shiftRuleMap) {
    this.shiftRuleMap = shiftRuleMap;
  }

  public List<TimeScopeEntity> getSignTime() {
    return signTime;
  }

  public void setSignTime(List<TimeScopeEntity> signTime) {
    this.signTime = signTime;
  }

  public List<TimeScopeEntity> getWorkTime() {
    return workTime;
  }

  public void setWorkTime(List<TimeScopeEntity> workTime) {
    this.workTime = workTime;
  }

  public String getHalfcalrule() {
    return halfcalrule;
  }

  public void setHalfcalrule(String halfcalrule) {
    this.halfcalrule = halfcalrule;
  }

  public List<Integer> getEachWorkMins() {
    return eachWorkMins;
  }

  public void setEachWorkMins(List<Integer> eachWorkMins) {
    this.eachWorkMins = eachWorkMins;
  }

  public String getHalfcalpoint() {
    return halfcalpoint;
  }

  public void setHalfcalpoint(String halfcalpoint) {
    this.halfcalpoint = halfcalpoint;
  }

  public String getHalfcalpoint2cross() {
    return halfcalpoint2cross;
  }

  public void setHalfcalpoint2cross(String halfcalpoint2cross) {
    this.halfcalpoint2cross = halfcalpoint2cross;
  }

    public int getRestShift() {
        return restShift;
    }

    public void setRestShift(int restShift) {
        this.restShift = restShift;
    }

    public String getConvertAttendDay() {
        return convertAttendDay;
    }

    public void setConvertAttendDay(String convertAttendDay) {
        this.convertAttendDay = convertAttendDay;
    }

    public String getPreConvertAttendDay() {
        return preConvertAttendDay;
    }

    public void setPreConvertAttendDay(String preConvertAttendDay) {
        this.preConvertAttendDay = preConvertAttendDay;
    }
}
